exports.install = function (Vue, options) {
  Vue.prototype.isEmpty = function (value) {
    return value === null || value === undefined || value === '' || value === 'undefiend'
  }
  Vue.prototype.enc = function (str) {
    let encryptor = new JSEncrypt()
    let pubKey = '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC60AY384dr4z/YuH5lf+TR5/8WqMYz+7JbJdJyAjWjuYuxgOJ3Qwc3dpy1qpwMSVitYJ1lsJfq9YsR6a774swJN46Kk/rkMciHrUleXGBJjQ3fYn/ZgEnP9Q1xlB2qcl/tJr1a8cvmrC6XRnyq1I9v4HYpIVcuKucsR6GXPCX/bwIDAQAB-----END PUBLIC KEY-----'
    encryptor.setPublicKey(pubKey)
    return encryptor.encrypt(str)
  }
  Vue.prototype.alert = function (msg, top) {
    $.messager.show(msg, top)
  }
  Vue.prototype.post = function (api, param, options) {
    param.token = this.$store.state.token || '';
    // let mergedData = Object.assign({}, JSON.parse(sessionStorage.getItem("_token")) , param)
    // 调用原始的post方法，并返回一个Promise
    return this.$http.post('/api/' + api, param, options)
  }
  // Vue.http.headers.common['token'] = 'Ebook_' + getToken()
}